form method='get'
    
    button type='submit' name='car_mo_check' 保存

	= simple_form_for(@customer, html: {class: 'form-vertical', novalidate: true}, wrapper: :vertical_form) do |o|
	  .row

		  .col-md-12

		    = o.input :car_brand_id, collection: @car_brands, as: :collection_select, label: '品牌'

		    = o.input :car_model_id, collection: @car_brands, as: :grouped_collection_select, group_method: :car_models, label: '车型'





coffee:
  jQuery ->
    $('#customer_car_model_id').parent().hide()
    car_models = $('#customer_car_model_id').html()
    $('#customer_car_brand_id').change ->
      car_brand = $('#customer_car_brand_id :selected').text()
      escaped_car_brand = car_brand.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1')
      options = $(car_models).filter("optgroup[label='#{escaped_car_brand}']").html()
      if options
        $('#customer_car_model_id').html(options)
        $('#customer_car_model_id').parent().show()
      else
        $('#customer_car_model_id').empty()
        $('#customer_car_mddel_id').parent().hide()